// #include <stdint.h>
#include "HT162X_Lcd.h"
#include "HT162X_Parts.h"

#ifndef HT162X_H
#define HT162X_H


//HT Seg
typedef enum
{
    HT_Seg_0,
    HT_Seg_1,
    HT_Seg_2,
    HT_Seg_3,
    HT_Seg_4,
    HT_Seg_5,
    HT_Seg_6,
    HT_Seg_7,
    HT_Seg_8,
    HT_Seg_9,
    HT_Seg_10,
    HT_Seg_11,
    HT_Seg_12,
    HT_Seg_13,
    HT_Seg_14,
    HT_Seg_15,
}HT_Seg_E;
//Cad_LCD Pin
//将Cad段码屏的引脚 与 1622段码驱动芯片建立联系枚举
//只需要更改该联系表,就能确保 PCB上段码驱动芯片 和 段码屏引脚 布线有效
typedef enum
{
    Cad_Pin_1 = HT_Seg_4,
    Cad_Pin_2 = HT_Seg_5, 
    Cad_Pin_3 = HT_Seg_6, 
    Cad_Pin_4 = HT_Seg_7, 
    Cad_Pin_5 = HT_Seg_8, 
    Cad_Pin_6 = HT_Seg_9, 
    Cad_Pin_7 = HT_Seg_10, 
    Cad_Pin_8 = HT_Seg_11, 
    Cad_Pin_9 = HT_Seg_12, 
    Cad_Pin_10 = HT_Seg_13,
    Cad_Pin_11 = HT_Seg_14,
    Cad_Pin_12 = HT_Seg_15,
    Cad_Pin_13 = HT_Seg_3,
    Cad_Pin_14 = HT_Seg_2,
    Cad_Pin_15 = HT_Seg_1,
    Cad_Pin_16 = HT_Seg_0,
}Cad_Pin_E;
//Cad_LCD Com
typedef enum
{
    Cad_Com1 = 0x01, //Cad_Pin_17 //HT发送数据从低位开始发送
    Cad_Com2 = 0x02, //Cad_Pin_18
    Cad_Com3 = 0x04, //Cad_Pin_19
    Cad_Com4 = 0x08, //Cad_Pin_20
    Cad_Com5 = 0x10, //Cad_Pin_21
    Cad_Com6 = 0x20, //Cad_Pin_22
    Cad_Com7 = 0x40, //Cad_Pin_23
    Cad_Com8 = 0x80, //Cad_Pin_24
}Cad_Com_E;

typedef struct
{
    Cad_Com_E Cad_Com;
    Cad_Pin_E Cad_Pin;
    Char_E Cad_Dis;
}Cad_Dat_S;

//外部引脚驱动接口
typedef struct
{
    void (*HT_CS_Handled)(uint8_t);
    void (*HT_WR_Handled)(uint8_t);
    void (*HT_RD_Handled)(uint8_t);
    void (*HT_Data_Handled)(uint8_t);
}HT162X_Device_S;
typedef struct 
{
    uint8_t address;
    uint8_t data;
}HT_Data_S;

void HT162X_Init(void);
void HT162X_RAM_Tx(void);
void HT162X_Reset(void);

void HT_RAM_Setting(Cad_Dat_S Cad_Dat);

#endif
